import { get, post, put, del } from '@/utils/request'

// 客户相关API
export const getCustomers = (params) => {
  // 传递分页和搜索参数
  return get('/product/product-client/api/customerInfo/list', params)
}

export const updateCustomer = (data) => {
  return put(`/product/product-client/api/customerInfo/update/${data.id}`, data)
}

export const getCustomerDetail = (id) => {
  return get(`/product/product-client/api/customerInfo/get/${id}`)
}

export const createCustomer = (data) => {
  return post('/product/product-client/api/customerInfo/add', data)
}

export const deleteCustomer = (id) => {
  return del(`/product/product-client/api/customerInfo/delete/${id}`)
}

export const searchCustomersByName = (params) => {
  return get('/product/product-client/api/customerInfo/searchByName?' + new URLSearchParams(params).toString())
}
